
import zmq
from zmq.utils import jsonapi

def main():
	"""docstring for main"""

	num_requests = 1
	context = zmq.Context()
	socket = context.socket(zmq.REQ)
	socket.connect("tcp://127.0.0.1:5555")

	requests = [
		#{
		#	'method':'GET',
		#	'uri':'/',
		#},
		{
			'method':'GET',
			'uri':'/google_api/check_user', 
			'domain':'', 
			'params':{
					'domain':'cradlepoint.com', 
					'user_id':'jeff', 
					}, 
		},
	]

	for i in xrange(num_requests):
		for req in requests:
			req['msg_id'] = i
			print("sending:%s\n" % (req))
			print("sending json:%s\n" % (req))
		 	sj = jsonapi.dumps(req)
			socket.send(sj)
			reply = socket.recv()
			print("reply raw data:%s\n" % reply)
			print("reply:%s\n" % jsonapi.loads(reply))
#main()

if __name__ == '__main__':
	main()
